Method and System for Dynamic Remote injection of In-process Agents into Virtual Machine based Applications

ABSTRACT

A method and system for dynamic and adaptive deployment of in-process agents to virtual machine based applications which may run on remote hosts is provided. A bootstrap agent is injected into the application, using standardized interfaces provided by virtual machine based systems like Sun Microsystems&#39; Java or Microsoft&#39;s .NET. Said bootstrap agent establishes a network connection to a management server which provides binaries representing in-process agents in bytecode or native code format. The bootstrap agent sends data identifying its runtime environment to the management server, which determines the matching in-process agent binaries for the runtime environment of the connected agent and sends the selected binaries to the bootstrap agent. The bootstrap agent receives the binaries and installs them to its hosting virtual machine, according to their format (bytecode or native code).

PRIORITY

The present invention claims priority under 35 USC section 119 and basedupon provisional application with a Ser. No. 60/917,951 which was filedon May 15, 2007.

FIELD OF THE INVENTION

The present invention relates to a system for dynamic injection ofagents into remote applications. More particularly, the injected agentsrun within the process of the applications and have access toapplication data and resources without overhead caused by inter processcommunication or network connections.

The system is suitable to inject introspection agents used to capturedata from monitored applications for usage by performance monitoring andfailure diagnosis tools, but it may be used to deploy in process agentsserving arbitrary purposes.

BACKGROUND OF THE INVENTION

The functionality of typical e-commerce applications is distributed overseveral tiers serving different purposes, like a business logic tier, apresentation tier or a database tier. Those tiers may be deployed todifferent servers or server clusters to enable scalability of theapplications.

Large scaled organizations operate hundreds of such e-commerceapplications, which may be distributed over thousands of differentservers. The management and maintenance of such systems is a highlycomplex and difficult task, due to the large number of different serversystems.

The configuration and management of an agent deployment system capablefor such large scaled systems must be lightweight and less intrusive tothe configuration of the applications the agents are deployed to.Alterations of application configuration required for agent deploymentmust be reduced to a minimum, and an easy and convenient way to manageand update the deployed agents must be provided.

Bytecode and virtual machine based systems like Sun Microsystems' Javaor Microsoft's .NET provide interfaces enabling the injection of agentsinto the process of bytecode interpreting virtual machines. Currentagent deployment approaches for said virtual machine based systems adaptthe configuration of the application by adding additional bytecodelibraries to the bytecode libraries loaded by the application. Someapproaches replace runtime libraries of the virtual machine hosting theapplication. Most approaches require to copy also configuration data,e.g. in form of XML-Config files locally to the server that hosts theapplication. Additionally, most current approaches require copying ofmultiple files locally to the server.

Consequently, an alternative system for agent deployment is required,which minimizes required configuration changes, and preferably onlyimpacts the configuration of the virtual machine, leaving theconfiguration of the application unchanged. Additionally, thealternative system should not require copying bytecode librariesmanually to servers hosting the application. The possibility to manage,update or upgrade the deployed agent from a remote, centralizedmanagement server should be provided.

SUMMARY OF THE INVENTION

A method for dynamically injecting an agent into an application mayinclude the steps of connecting a bootstrap agent to the managementserver from a virtual machine, the management server being external tothe virtual machine, initiating connections with the management server,requesting a handshake between the management server and the virtualmachine by the bootstrap agent in response to the connections,determining matching in process agent binaries in response to thehandshake and installing the in process agent binaries to theapplication of the management server.

The step of verifying that the version of the connected bootstrap agentmay be supported by the management server, and the step of initiatingconnections includes the step of verifying that the version of thevirtual machine may be supported by the management server.

The version of the bootstrap agent and the version of the virtualmachine may be used to determine the matching in process agent binaries,and the format of the game process agent binaries may be determined.

The format of the in process agent binaries may be byte code, and theformat of the in process agent binaries may be native code.

The byte code may be a single byte code in process agent binary and thenative code may be a single native code in process agent binary.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 conceptually describes the architecture of a preferableembodiment for dynamic injection of in-process agent binaries, showing amanagement server holding multiple in-process agent binaries and anapplication configured to load and start the bootstrap agent oninitialization

FIG. 2 depicts the application after the deployment of in-process agents(native or bytecode) by the bootstrap agent.

FIG. 3 conceptually depicts an agent deployment node which may be usedto wrap binaries of an in-process agent and may be sent via networkconnection to a bootstrap agent running within the virtual machine of anapplication.

FIG. 4 shows the process of connecting the bootstrap agent to amanagement server, requesting in-process agent binaries, receiving therequested binaries and loading them to the virtual machine of theapplication.

FIG. 5 provides a flowchart of the process of an incoming bootstrapagent connection which is accepted by the management server, determiningthe matching in-process agent binary version according to the bootstrapagent version and the runtime environment of the application. Further itdepicts the sending of said in-process agent binaries to the bootstrapagent.

FIG. 6 a depicts the configuration of the bootstrap agent with astandalone application running on a virtual machine.

FIG. 6 b shows the configuration of the bootstrap agent in a setup wherean application server hosts multiple applications running on one virtualmachine

DETAILED DESCRIPTION

The bytecode based software platforms like Sun Microsystems' Java orMicrosoft's .NET framework provide interfaces to intercept the startupof virtual machines, to inject custom code into the virtual machines andto execute this code under control of the virtual machine.

The present invention is dedicated to a system and method for adaptive,dynamic, remote and automated injection of in-process agents intovirtual machine based applications. The system is independent of thearchitecture of the application, which may be either a monolithic, standalone application or an application running within the environment of adedicated application server.

The present system may not require loading of additional bytecodelibraries by the application. No modification or exchange of bytecodelibraries of the application may be required, and no exchange of runtimelibraries of the virtual machine may be needed. No access to applicationlibraries or alteration of said libraries may be required, and also theconfiguration of the libraries used by the application, e.g. for SunMicrosystems Java based applications, the CLASSPATH of the applicationmay not be affected.

Only deployment of a single additional file, the bootstrap agent librarymay be required. The bootstrap agent library file may reside at the hostrunning the application or it may reside on a centralized network shareto ease management of multiple applications and update of the bootstrapagent library.

The bootstrap agent loads the binaries of the in-process agent from aremote management server and injects the code into its hosting virtualmachine. No local storage of the binaries and thus no write access tothe local file system may be required.

Configuration of the bootstrap agent injection only consists in anadditional startup directive for the virtual machine running theapplication, pointing to the location of the bootstrap agent librarywhich is loaded and started during the initialization of the virtualmachine, before bytecode interpretation is started. The startupdirective also contains a parameter that specifies the network addressof a management server which is used by the bootstrap agent to load thein-process agent.

The in-process agent is injected into the process of the application,enabling access to the applications data and resources by simple methodor function calls without additional overhead caused by inter-process ornetwork communication.

The bootstrap agent is loaded and started during initialization of thevirtual machine of the application, and the parameter specifying theaddress of the management server is forwarded to the bootstrap agent.

The bootstrap agent establishes a network connection to the managementserver and requests the binaries representing the in-process agent. Saidbinaries may be in bytecode or native code format. Also a combination ofboth binary formats is supported by the present application. After thebootstrap agent received the requested binaries, it injects the receivedbinaries into the process of the application, using interfaces providedby the virtual machine to load bytecode for execution or to load andexecute native libraries.

The present invention takes advantage of these features and discloses amethod to automatically inject binaries representing in-process agentsinto applications, without the requirement to change applicationspecific configurations. The injected in-process agents are executedwithin the process of the application which enables access toapplication data and resources at the same level as original applicationcode.

FIG. 1 shows an architectural block chart of an exemplary embodimentproviding a method and system for dynamic and automated injection ofin-process agents, containing an application 101 that loads and runs abootstrap agent 104, and a management server 108. Application 101 andmanagement server 108 are located at different hosts and the bootstrapagent 104 communicates with the management server 108 using a networkconnection.

A bootstrap agent 104 is loaded and started by the virtual machine 102hosting the application 101, during initialization. Information aboutthe physical location of the binary of the bootstrap agent 104 isprovided to the virtual machine through startup parameters, conveyedeither via command line parameters or startup scripts. Additionally,information about the network address of the management server 107 isprovided to the bootstrap agent via startup parameters.

After the bootstrap agent 104 is loaded and started by the virtualmachine, it initializes a network connection to the management server108, requests a protocol handshake and transmission of the in-processagent binaries 106 from the management server 108.

The management server 108 accepts incoming bootstrap agent connectionsand forwards the connection to the agent deployment engine 109, whichverifies if the version of the connected bootstrap agent in combinationwith the version of its hosting virtual machine are supported by themanagement server 108 and sends a handshake response accordingly. If thehandshake was successful and a subsequent request for in-process agenttransmission 106 is received, the deployment engine 109 uses dataconcerning the version of the bootstrap agent 104 and its hostingvirtual machine 102 received during handshake to determine matchingin-process agent binaries 110 for the requesting bootstrap agent 104.The matching in-process agent binaries 110 are loaded and analyzed bythe deployment engine 109 to extract metadata required to install thein-process agent binaries to the application 101. In-process agentbinaries 110 and extracted metadata are sent to the bootstrap agent 104,using the network connection established by said bootstrap agent 104.

The bootstrap agent 104 receives in-process agent binaries 110 anddetermines if the format of said in-process agent binaries is bytecodeor native code, and loads received bytecode to the bytecode repository103 of the virtual machine 102, and received native binaries to thenative code execution module 105 of the virtual machine 102.

FIG. 2 depicts an application after the deployment and injection of abytecode 201 and a native in-process agent 202. Present invention iscapable to inject any combination of bytecode and native in-processagents, e.g. injecting a single bytecode in-process agent 201, a singlenative in-process agent 202 or both a bytecode and a native in-processagent into an application 101. Additionally, the invention enablesincremental in-process agent injection, where a bootstrap agent 104first injects a native agent 202, which in turn requests the deploymentof a bytecode agent 201.

FIG. 3 shows the preferred embodiment of an agent deployment node 301.Agent deployment nodes 301 contain binary data 303 representing thefunctionality or parts of the functionality of a bytecode in-processagent 201, or a native in-process agent 202, which is injected into anapplication 101. Additionally, an agent deployment node containsmetadata 302 describing said binary data. The metadata is required forthe installation of the binary data 303 into the virtual machine 103 ofthe application 101. The metadata contains but is not limited to thename of the binary, type of the binary (bytecode or native) and the sizeof the binary data 303.

Agent deployment nodes 301 are used to transmit agent binaries 110 fromthe agent deployment engine 109 to the bootstrap agent 104.

FIG. 4 depicts the process of connecting the bootstrap agent 104 to themanagement server 108 and receiving in-process agent binaries 110 aftera successful initial protocol handshake.

The bootstrap agent 104 is loaded and started by the virtual machine 102on initialization, prior to the start of loading or processing bytecodeof the application 101. At a first step, the bootstrap agent 104establishes a network connection to the management server 108. Thenetwork address of the management server 108 is provided to the virtualmachine via command line or script parameter and forwarded to thebootstrap agent.

After the network connection between the bootstrap agent 104 and themanagement server 108 is established, the bootstrap agent 104 sends arequest for a protocol handshake 106 to the management server 108. Thehandshake request contains but is not limited to data about the versionof the bootstrap agent, and information about the runtime environment ofthe application 101 containing but not limited to type, vendor andarchitecture of the virtual machine 102 hosting application 101 andbootstrap agent 104.

If the handshake request was performed successfully, the bootstrap agent104 sends a request for transmission of the in-process agent binaries106. In case of a failed handshake, the bootstrap agent reports an errorevent to its error log and closes the network connection to themanagement server. Execution of the application 101 continues withoutinjected bytecode 201 or native 202 in-process agents.

The bootstrap agent 104 receives a response to the in-process agentdeployment request indicating the availability of in-process agentbinaries 110 matching the virtual machine configuration of the monitoredapplication. If the response indicates that no matching in-process agentbinaries 110 are available, the bootstrap agent 104 issues an error logbefore closing the network connection to the management server 108.Execution of the application 101 continues without injected bytecode 201or native 202 in-process agents.

In case matching in-process agent binaries are available, the bootstrapagent 104 first receives all agent deployment nodes sent by themanagement server 108. After all agent deployment nodes 301 arereceived, the bootstrap agent 104 extracts binary date and the metadatarequired for the installation of the binary data from the received agentdeployment nodes 301 and starts to install the received binaries to thevirtual machine 102. The order of transmissions and installation takesinterdependencies between different binaries taken into account. If allreceived binaries are installed successfully, the injected in-processbytecode 201 or native agent 202 can be initialized and executed. Thenetwork connection between the bootstrap agent 104 and the managementserver 108 remains open to enable communication between the injectednative or bytecode in-process agent 201 or 202 and the management server108 using the bootstrap agent 104. Execution of the application 101continues with injected bytecode 201 or native 202 in-process agents.

In case of loading an in-process agent binary causes an error, thebootstrap agent closes the network connection to the management server108 and reports an error to its log. Execution of the application 101continues without injected bytecode 201 or native 202 in-process agents.

FIG. 5 illustrates the processing of a handshake request and a followingrequest to deploy in-process agent binaries by the management server 108using the agent deployment engine 109.

On receiving a handshake request from a bootstrap agent 104, themanagement server 108 first determines if version of the bootstrap agent104 and type of the runtime environment of the application 101, asreported via the handshake request message, are supported by themanagement server 108. If the bootstrap agent 104 version or runtimeenvironment of the application 101 is not supported by the managementserver 108, an error response is sent to the bootstrap agent 104, whichin turn terminates the network connection to the management server.

After a successful handshake, the management server may receive arequest for deployment of in-process agent binaries 106, which isforwarded to the agent deployment engine 108. The agent deploymentengine 108 is using information received during the earlier handshake todetermine the matching in-process agent binaries for the requestingbootstrap agent 104 and subsequently loads the respective binaries. Ifloading of the binaries fails, an error response is sent to thebootstrap agent, which in turn closes the network connection to themanagement server 108.

The loaded in-process agent binaries 110 are analyzed by the agentdeployment engine 108 which first extracts metadata required to installthe binaries at the application 101. Agent deployment nodes 301 arecreated and initialized with metadata required to install the loadedbinaries in the virtual machine of the bootstrap agent 104 which isextracted from the loaded binaries. Additionally, the loaded binary dataitself is stored in the created agent deployment nodes 301. Theinitialized agent deployment nodes 301 are sent to the bootstrap agent104 using the network connection created by said bootstrap agent 104.

FIG. 6 a and FIG. 6 b show the configuration adaptations required toinstall the bootstrap agent 104, whereas FIG. 6 a depicts theconfiguration of the bootstrap agent 104 with a standalone application101 running on a virtual machine 102 and FIG. 6 b shows theconfiguration of the bootstrap agent 104 in a setup where an applicationserver 604 hosts multiple applications 101 running on one virtualmachine.

FIGS. 6 a and 6 b show the configuration adaptations required to installthe bootstrap agent. Installing the bootstrap agent does not affect theconfiguration data of the application 601, which contains applicationspecific configuration that changes from application to application. Thebootstrap agent configuration 603 is located within the configuration ofthe virtual machine 602. This design allows reusing virtual machineconfigurations 602 which contain a bootstrap agent configuration 603 fordifferent applications, which simplifies installation of the bootstrapagent. The bootstrap agent configuration 603 may contain, but is notlimited to the location of the bootstrap agent binaries or an agent ID.

Typically, application configuration data contains data which isspecific to an application, like the libraries used by the application,relations between different components of the application etc.Application configuration data tends to be large and complex. Structureand content of this configuration data depend on the type of theapplication. Application configuration data may be packaged togetherwith the application binaries, like e.g. in a J2EE WAR or EAR file.

Application server configuration data contains defines the resourceswhich the application server provides to the applications it hosts, likedata base connection pools, component pools etc. This configuration datatypically consists in multiple, complex structured XML files. Structureand content of those files depend on version and vendor of theapplication server.

1. A method for dynamically injecting an agent into an application whichis executed by a virtual machine, comprising the steps of: connecting abootstrap agent to the management server from a virtual machineexecuting the application, the management server being external to thevirtual machine, initiating connections with the management server;requesting a handshake between the management server and the virtualmachine by the bootstrap agent in response to the connections;determining matching in process agent binaries in response to thehandshake; installing by the management server the in process agentbinaries to the application executed by the virtual machine.
 2. A methodfor dynamically injecting an agent into an application as in claim 1,wherein the step of initiating connections includes the step ofverifying that the version of the connected bootstrap agent is supportedby the management server.
 3. A method for dynamically injecting an agentinto an application as in claim 1, wherein the step of initiatingconnections includes the step of verifying that the version of thevirtual machine is supported by the management server.
 4. A method fordynamically injecting an agent into an application as in claim 1,wherein the version of the bootstrap agent and the version of thevirtual machine is used to determine the matching in process agentbinaries.
 5. A method for dynamically injecting an agent into anapplication as in claim 1, wherein the format of the in process agentbinaries is determined.
 6. A method for dynamically injecting an agentinto an application as in claim 1, wherein the format of the in processagent binaries is byte code.
 7. A method for dynamically injecting anagent into an application as in claim 1, wherein the format of the inprocess agent binaries is native code.
 8. A method for dynamicallyinjecting an agent into an application as in claim 6, wherein the bytecode is a single byte code in process agent binary.
 9. A method fordynamically injecting an agent into an application as in claim 7,wherein the native code is a single native code in process agent binary.10. A system for dynamically injecting an agent into an applicationwhich is executed by a virtual machine, comprising: a virtual machinefor connecting a bootstrap agent to a management server, the managementserver being external to the virtual machine, the virtual machineinitiating connections with the management server; a handshake beingrequested between the management server and the virtual machine by thebootstrap agent in response to the connections; in process agentbinaries being matched in response to the handshake; the in processagent binaries being installed by the management server to theapplication executed by the virtual machine.
 11. A system fordynamically injecting an agent into an application as in claim 10,wherein the version of the connected bootstrap agent is verified asbeing supported by the management server.
 12. A system for dynamicallyinjecting an agent into an application as in claim 10, wherein theversion of the virtual machine is verified as being supported by themanagement server.
 13. A system for dynamically injecting an agent intoan application as in claim 10, wherein the version of the bootstrapagent and the version of the virtual machine is used to determine thematching in process agent binaries.
 14. A system for dynamicallyinjecting an agent into an application as in claim 10, wherein theformat of the in process agent binaries is determined.
 15. A system fordynamically injecting an agent into an application as in claim 10,wherein the format of the in process agent binaries is byte code.
 16. Asystem for dynamically injecting an agent into an application as inclaim 10, wherein the format of the in process agent binaries is nativecode.
 17. A system for dynamically injecting an agent into anapplication as in claim 15, wherein the byte code is a single byte codein process agent binary.
 18. A system for dynamically injecting an agentinto an application as in claim 16, wherein the native code is a singlenative code in process agent binary.
 19. A method for dynamicallyinjecting an agent into an application as in claim 1, wherein bootstrapagent configuration information is located within the configuration ofthe virtual machine.
 20. A system for dynamically injecting an agentinto an application as in claim 10, wherein bootstrap agentconfiguration information is located within the configuration of thevirtual machine.